<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title> - 邮件管理</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="favicon.ico"> <link href="__STATIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__STATIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="__STATIC__/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	<link href="__STATIC__/css/animate.css" rel="stylesheet">
	<link href="__STATIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__STATIC__/css/new_file.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox">
				<div class="ibox-title">
					<h5>邮件管理</h5>
				</div>
				<div class="ibox-content">
					<a href="Mail.html"><button type="button" class="btn btn-w-m btn-info btn-bt">新建邮件</button></a>
					<a href="Mail_1.html"><button type="button" class="btn btn-w-m btn-white btn-bt">历史记录</button></a>
					<a href="Mail_2.html"><button type="button" class="btn btn-w-m btn-white btn-bt">操作记录</button></a>
					<div class="clients-list">
						<div id="tab-1" class="tab-pane tab-bortop">
							<form class="form-horizontal from-sevn" action="{:url('Email/new_email')}" enctype="multipart/form-data" method="post" id="form"><br/>
								<div class="form-group">
									<label class="col-sm-2 control-label">邮件主题：</label>

									<div class="col-sm-8">
										<input type="text" placeholder="12汉字以内" class="form-control" name="title" id="title">
										<span class="help-block m-b-none">请输入邮件主题</span>
									</div>
								</div>
								<!--<div class="form-group">-->
									<!--<label class="col-sm-2 control-label">充值区间：</label>-->
									<!--<div class="col-sm-8 col-disp">-->
										<!--<input type="text" placeholder="累计充值金额区间" class="form-control form-contime" name="recharge_min">- -->
										<!--<input type="text" placeholder="累计充值金额区间" class="form-control form-contime" name="recharge_max">-->
										<!--<span class="help-block m-b-none">请输入充值区间</span>-->
									<!--</div>-->
								<!--</div>-->
								<!--<div class="form-group">-->
									<!--<label class="col-sm-2 control-label">创建时间：</label>-->
									<!--<div class="col-sm-8">-->
										<!--<input type="text" placeholder="用户账号创建时间区间" class="form-control form-time-bk" id="time1"  name="establish_time" readonly="readonly">-->
										<!--<span class="help-block m-b-none">请输入创建时间</span>-->
									<!--</div>-->
								<!--</div>-->
								<!--<div class="form-group">-->
									<!--<label class="col-sm-2 control-label">最后登录时间：</label>-->
									<!--<div class="col-sm-8">-->
										<!--<input type="text" placeholder="用户最后登录游戏时间区间" class="form-control form-time-bk" id="time2" name="Login_time" readonly="readonly">-->
										<!--<span class="help-block m-b-none">请输入最后登录时间</span>-->
									<!--</div>-->
								<!--</div>-->
								<div class="form-group">
									<label class="col-sm-2 control-label">收件人：</label>
									<div class="col-sm-8">
										<select  class="form-control form-consele" id="consignee" name="recipient_type">

											<option value ="1">UID</option>
											<option value ="0">群发</option>
											<option value ="2">亲友圈</option>
										</select>
									</div>
								</div>
								<div class="form-group form-con1">
									<label class="col-sm-2 control-label">UID：</label>
									<div class="col-sm-8 col-disp">
										<input type="text" placeholder="可输入多个玩家UID，用逗号分割" class="form-control" name="UID_text">
										<span class="help-block m-b-none">请输入玩家UID</span>
										<input type="button" class="col-fileanniu btn-info" value="上传">
										<input type="file" class="col-file" name="UID">
									</div>
								</div>
								<div class="form-group form-con2">
									<label class="col-sm-2 control-label">亲友圈：</label>
									<div class="col-sm-8 col-disp">
										<input type="text" placeholder="可输入多个亲友圈，用逗号分割" class="form-control" name="club_text">
										<span class="help-block m-b-none">请输入亲友圈</span>
										<input type="button" class="col-fileanniu btn-info" value="上传">
										<input type="file" class="col-file" name="club">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">附件：</label>
									<div class="col-sm-3">
										<select  class="select_ys select_wid" name="assets_1" id="assets_1">
											<option value ="">请选择附件</option>
										</select>
									</div>
									<div class="col-sm-3">
										<input type="text" placeholder="请输入数量" class="form-control" name="assets_1_num" id="assets_1_num">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label"></label>
									<div class="col-sm-3">
										<select  class="select_ys select_wid" name="assets_2" id="assets_2">
											<option value ="">请选择附件</option>
										</select>
									</div>
									<div class="col-sm-3">
										<input type="text" placeholder="请输入数量" class="form-control" name="assets_2_num" id="assets_2_num">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label"></label>
									<div class="col-sm-3">
										<select  class="select_ys select_wid" name="assets_3"  id="assets_3">
											<option value ="">请选择附件</option>
										</select>
									</div>
									<div class="col-sm-3">
										<input type="text" placeholder="请输入数量" class="form-control" name="assets_3_num" id="assets_3_num">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label"></label>
									<div class="col-sm-8">
										<textarea class="form-control form-textarea" name="content" id="content" placeholder="100汉字以内"></textarea>
										<span class="help-block m-b-none">请输入内容</span>
									</div>
								</div>
								<div class="form-group form-texcen">
									<button class="btn btn-info" type="reset">清空</button>
									<button class="btn btn-info" type="button" onclick="_checkedPost()">提交</button>
									<!--<button class="btn btn-info" type="button" id="submit">提交</button>-->
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--手机导航-->
<div class="to-fdh" style="display: none;">
	<img class="to-imgd" src="__STATIC__/img/phonedh.jpg">
	<div class="mob-nrlb">
		<ul>
			<li>
				<a class="mob-nrdh">管理</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('Player/gameplayer')}">玩家管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('system/notice')}">公告管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('email/mail')}">邮件管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Club/club')}">亲友圈管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Money/money')}">提现管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Order/order')}">订单管理</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh">数据</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('data/datagk')}">概況</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datawf')}">玩法</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datalc')}">留存</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datass')}">实时数据</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataczfx')}">充值分析</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataclub')}">亲友圈统计</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/president')}">高级会长</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/regionaldata')}">地区数据</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh">权限</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_list')}">权限管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_group')}">用户组管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('account/account_details')}">后台账号管理</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh mob-qbh" id="zkbg">展开表格</a>
			</li>
		</ul>
	</div>
</div>
<div class="vnl-zz" style="display:none">
	<div><img src="__STATIC__/img/bqhp.gif"></div>
</div>
<!--手机适配-->
<!-- 全局js -->
<script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__STATIC__/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__STATIC__/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
<script src="__STATIC__/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
<script src="__STATIC__/js/content.js?v=1.0.0"></script>
<script src="__STATIC__/js/plugins/laydate/laydate.js"></script>
<script>   //手机适配
$(function(){
    if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
        $("head").append("<link>");
        var css = $("head").children(":last");
        css.attr({
            rel:  "stylesheet",
            type: "text/css",
            href: "__STATIC__/css/phone_sp.css"
        });
        var mql = window.matchMedia("(orientation: portrait)");
        if(mql.matches) { //竖屏样式
            $(".vnl-zz").show();
            $(".to-fdh").hide();
        }else{
            $(".to-fdh").show();
            $("html").width("100%");
            $("body").width("100%");
        }
        mql.addListener(function(m) {
            if(m.matches) {
                // 改变到直立方向
                $(".vnl-zz").show();
                $(".to-fdh").hide();
            }
            else {
                $(".to-fdh").show();
                $(".vnl-zz").hide();
                $("html").width("100%");
                $("body").width("100%");
            }
        });
    }
});
//导航显示展开
$(".mob-nrdh").click(function(){
    $(this).next().toggle(".mob-nryc");
});
$(".to-imgd").click(function(){
    $(this).next().toggle(".mob-nrlb");
});
//手机适配end
    $(document).ready(function () {
        // $('.form-con1').hide();
        // $('.form-con2').hide();
        $('.form-con1').show();
        $('.form-con2').hide();
        $('.form-consele').on('change',function(){
            if ($('.form-consele').val() == '0') {
                $('.form-con1').hide();
                $('.form-con2').hide();
            } else if ($('.form-consele').val() == '1') {
                $('.form-con1').show();
                $('.form-con2').hide();
            } else if ($('.form-consele').val() == '2') {
                $('.form-con1').hide();
                $('.form-con2').show();
            }
        });
        laydate.render({
            elem: '#time1'
            ,type: 'datetime'
            ,range: true
        });
        laydate.render({
            elem: '#time2'
            ,type: 'datetime'
            ,range: true
        });
    });
    $(function() {
        $.ajax({
            type: "post",
            url: "{:url('Email/assets')}",
            data: {},
            dataType: "json",
            success: function(e) {
                console.log(e);
                for(i in e) {
                    $("#assets_1").append("<option value='" + e[i].id + "'>" + e[i].name + "</option>");
                    $("#assets_2").append("<option value='" + e[i].id + "'>" + e[i].name + "</option>");
                    $("#assets_3").append("<option value='" + e[i].id + "'>" + e[i].name + "</option>");
                }
            },
            error: function(e) {
                console.log(e);
            }
        });
    });
    function _checkedPost() {
        var title = $("#title").val();
        var content = $("#content").val();
        var goods = $("#goods").val();

        if(title == "") {
            alert("请输入邮件主题！");
            return false;
        }else if($("#content").val() == "") {
            alert("请输入邮件内容！");
            return false;
        }else if(title.length >12) {
            alert("邮件主题不得超过12个字！");
            return false;
        }else if(content.length >100) {
            alert("邮件内容不得超过100个字！");
            return false;
        }
        // else if(goods.split(';').length >3) {
        //     alert("每封邮件不得超过3种物品！");
        //     return false;
        // }

        else {
            // alert("成功！");
            document.getElementById("form").submit();
        }
    }
    $("#submit").on("click", function(event) {
        var form=$("#title").val();
        var formdata =new FormData(form);
        $.ajax({
            type: "POST",
            url: "{:url('Email/new_email')}",
            processData: false,  // 不要处理发送的数据
            contentType: false,   // 不要设置Content-Type请求头
            data:formdata,
            dataType:'json',
            success: function (data) {
                console.log(data);
                // if (data.status == 1) {
                //     alert(data.message);
                // window.parent.location.reload(); //刷新父页面
                // } else {
                //     alert(data.message);
                // }
            }
        });
    })

</script>
</body>
</html>
